home *** CD-ROM | disk | FTP | other *** search
/ New Masters of Flash / New Masters of Flash.iso / pc / MOVIES / 11.dir / 00048_Text_text08.txt < prev    next >
Text File  |  2000-10-01  |  2KB  |  32 lines

  1. Setting the Correspondences with Numeric Keypad input 
  2.  
  3. The script up to this point sets the fields with organically corresponding cells. The rest is simple. We need to set up the correspondences you want when the keys are pressed. In order to get the cells to expand when a key is pressed, all you need to do is to add some form of increment to the speeds of the edge lengths of the cells (VX1 to 3 and VY1 to 3), which were so laboriously set in the preceding sections.
  4. More specifically, all you need do is insert scripts such as the following into a dummy button (located on the hidden button layout in this sample).
  5. On (Key: 1) 
  6. VX1 =VX1+plusV;
  7. VY1 =VY1+plusV;
  8. }
  9.  
  10. Here, plusV is the increment added to the edge lengths of the cells when the keys are pressed. 
  11.  
  12. This script means that when the key 1 is pressed, VX1 and VY1, which is to say the speeds of the lengths of the edges of the cell corresponding to key 1 accelerate by an amount equivalent to the magnitude of plusV.
  13.  
  14. In addition, from frame 2 onwards, animation involving a slight change of color is added to the movie symbol of the cell corresponding to key 1, (a stop is put on Frame 1. See Figure 3-5), and a small degree of coloring can be added by Tell Targeting using the following script:
  15.  
  16. Begin Tell Target (ΓÇ£/tenkey/key1ΓÇ¥) 
  17. Go to and Play (2) 
  18. End Tell Target
  19.  
  20. The cell color changes when a key is pressed.
  21.  
  22. To summarize, the script when the key 1 is pressed is as follows: 
  23.  
  24. on (keyPress: ΓÇ£1ΓÇ¥) {
  25.    VX1 =VX1+plusV;
  26.    VY1 =VY1+plusV;
  27.    tellTarget (ΓÇ£/tenkey/key1ΓÇ¥) {
  28.     gotoAndPlay (2);
  29.   }
  30. }
  31.  
  32. Then the operation simply needs to be repeated for the other keys (2 to 9). And thatΓÇÖs it.